<div class="row">
    <div class="col-sm-4">
        <input type="text" placeholder="搜索标题"
               ng-model="search" class="form-control">
    </div>
    <div class="col-sm-4">
        <select name="" ng-model="orderByType" class="form-control">
            <option value="title" ng-selected="true">书名</option>
            <option value="author">作者</option>
            <option value="price">价格</option>
            <option value="pudate">日期</option>
        </select>
    </div>
    <div class="col-sm-4">
        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal" ng-disabled="!userservice.isLogin">
            查看购物车
            <span class="badge" style="color:white; background-color:red;">{{cartNum}}</span>
        </button>
        <a ng-show="userservice.isLogin"
           class="btn btn-primary"
           ng-click="loginOut()"
        >
            登出
        </a>
        <a ng-href="#/login"
           ng-show="!userservice.isLogin"
           class="btn btn-primary">
            登录
        </a>


    </div>
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">购物车</h4>
                </div>
                <div class="modal-body">
                    <table class="table table-bordered">
                        <tr>
                            <th>名称</th>
                            <th>单价</th>
                            <th>数量</th>
                            <th>小计</th>
                        </tr>

                        <tr ng-repeat="item in cartList">
                            <td>{{item.name}}</td>
                            <td>{{item.price}}</td>
                            <td>
                                  <button class="btn btn-primary" ng-click="cartJian(item.gid)">-</button>
                                  <input type="text" ng-model="item.num">
                                  <button class="btn btn-primary" ng-click="cartJia(item.gid)">+</button>
                            </td>
                            <td>{{item.price*item.num}}</td>
                        </tr>
                    </table>
                    <h2>总价：{{total|currency:"RMB:"}}</h2>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary">下单</button>
                </div>
            </div>
        </div>
    </div>
</div>

<p></p>
<div class="row">
    <ul class="list-group">
        <li class="list-group-item"
            ng-repeat="book in books | filter:{title:search} | orderBy:orderByType">
            <div class="row">
                <a ng-href="#/bookDetail/{{book.id}}">
                    
                    <div class="col-sm-4">
                        <img ng-src="{{IMAGEURL + book.images[0].image_name}}" alt=""
                             class="img-responsive img-thumbnail">
                            
                    </div>
                </a>
                <div class="col-sm-8">
                    <blockquote>
                        <h1>书名：{{book.title}}</h1>
                        <footer>作者：{{book.author}}</footer>
                        <p>价格：{{book.price}}</p>
                        <p>出版日期：{{book.pudate * 1000 | date:"yyyy-MM-dd HH:mm:ss"}}</p>
                        <button class="btn btn-primary" ng-click="buy(book)">加入购物车</button>
                    </blockquote>
                </div>
                
            </div>

        </li>
    </ul> 
</div>

